{extend name="common/base" /}

{block name="body"} 
<div class="head_box">
    <i class="layui-icon layui-icon-left back" data-btn="backNav" onclick="window.history.go(-1);"></i>
    <div class="t1">开始记录</div>
 </div>
 <main class="main_body">

    <table class="layui-table chart_table layui-form" lay-skin="line">
       <colgroup>
       </colgroup>
       <thead>
          <tr>
             <th style="padding-left: 2em;">吊车</th>
             <th>工程号</th>
             <th>阶段</th>
             <th>分段类型</th>
             <th>分段号</th>
          </tr>
       </thead>
       <tbody>
        {volist name="list" id="vo"}
           <tr>
            <td>
               <input type="radio" name="crane_id" value="{$vo.id}" title="{$vo.crane.name}">
            </td>
            <td>{$vo.produce_no}</td>
            <td>{$vo.stage.name}</td>
            <td>{$vo.segment.name}</td>
            <td>{$vo.segment_type_no}</td>
         </tr>
        {/volist}

       </tbody>
    </table>
    <a href="javascript:void(0);" id="startRecordLink">
        <button class="layui-btn w100 mt30">开始记录</button>
    </a>
 </main>
{/block}
{block name="js"}
<script>
   $('.back').click(function(){
      window.location.href = '/index';
   })
    $('#startRecordLink').click(function() {
            // 获取被选中的 radio 的值
            var craneId = $('input[name="crane_id"]:checked').val();

            // 检查是否选择了
            if (!craneId) {
                layer.msg('请先选择一个计划。');
                return;
            }

            // 构建新的链接，添加 crane_id 查询参数
            var newUrl = 'record_add/' + craneId;

            // 跳转到新的链接
            window.location.href = newUrl;
        });
 </script>
{/block}

